package com.hjli.main;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.hjli.tool.PropertiesTool;

public class StartSessionInit implements HttpSessionListener,ServletContextListener{

	@Override
	public void sessionCreated(HttpSessionEvent se) {
		// TODO Auto-generated method stub
		HttpSession session = se.getSession();
		Map<String,Object> emailMap = new HashMap<String,Object>();
		PropertiesTool property = new PropertiesTool();
		String mail_User = property.getValueByKey("email.properties", "mail.user");
		emailMap.put("mail.user", mail_User);
		session.setAttribute("emailProp", emailMap);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent se) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		
	}
	
}
